/*
 * @Description: 
 * @Author: duan_shuangjun 丶
 * @Date: 2025-08-20 22:34:31
 * @LastEditTime: 2025-11-11 22:34:01
 */
// 桌台相关api
import http from '@/utils/http'
import { isOnline } from '@/utils/network'
import { offlineApi } from '@/utils/offlineDecorator'
// key对应函数名，value对应api地址
const api = {
    // 获取桌台列表
    fetchDeskList: 'desk/list',
    // 获取桌台分类列表
    fetchCategoryList: 'desk/getCategoryList',
    // 获取桌台分区列表
    fetchRegionList: 'desk/getRegionList',
    // 获取桌台详情
    fetchDeskDetail: 'desk/detail',
    // 单席开台，空桌开台
    openSingleDesk: 'desk/openSingleDesk',
    // 多席开台
    openMostDesk: 'desk/openMostDesk',
    // 转台操作
    moveDesk: 'desk/moveDesk',
    // 撤台操作
    clearDesk: 'desk/clearDesk',
    // 搭台操作
    groupDesk: 'desk/groupDesk',
    // 并台操作
    mergeDesk: 'desk/mergeDesk',
    // 修改桌台使用人数（用餐人数）
    deskEditUseNum: 'desk_order/editUseNum',
    // 订单绑定用户(桌台绑定会员)
    deskOrderBindUser: 'desk_order/bindUser',
    // 锁台
    deskLockDesk: 'desk/lockDesk',
    // 解除桌台锁定
    deskUnLockDesk: 'desk/unLockDesk',
    // 桌台订单结算
    orderSettlement: 'deskOrder/orderSettlement',
    // 下单之后的操作：修改规格\数量
    orderFoodEditNum: 'orderFood/editNum',
    // 下单之后的操作：查询已点菜品数量和菜品详情
    orderFoodDetail: 'orderFood/foodDetail',
    // 下单之后的操作：查询套餐详情
    orderFoodgroupDetail: 'shopFood/orderFoodgroupDetail',
    // 查询当前桌台可退菜菜品
    orderFoodOperableFoodList: 'orderFood/operableFoodList',
    // 列表退菜(批量退菜or全单退菜)[批量退菜也使用这个]
    orderFoodBatchBack: 'orderFood/backList',
    // 取消/开启会员价，状态(0:关闭会员价 1:启用会员价)
    editMemberPrice: 'deskRecord/editMemberPrice',
    // 取消/开启会员折扣，状态(0:关闭会员折扣 1:启用会员折扣)
    editMemberDiscount: 'deskRecord/editMemberDiscount',
    // 修改不打折金额
    editUnDiscountMoney: 'deskOrder/editUnDiscountMoney',
    // 修改抹零金额
    deskOrderReduceMoney: 'deskOrder/reduceMoney',
    // 修改菜品做法
    orderFoodEditMaking: 'orderFood/editMaking',
    // 全桌上菜
    deskRecordOrderServe: 'deskRecord/orderServe',
    // 获取选中菜品桌台回显
    deskOrderFoodRecordList: 'desk/orderFoodRecordList',
    // 多台开席回显，多台开席调整专用
    deskMultipleRecordList: 'desk/multipleRecordList',
    // 修改服务费
    deskOrderEditServiceMoney: 'deskOrder/editServiceMoney',
    // 多台开席调整
    deskEditMostDesk: 'desk/editMostDesk',
    // 开班
    deskStartWork: 'workLog/startWork',
    // 交班（结束营业）
    deskEndWork: 'workLog/endWork',
    // 获取当前店铺开班状态 || 获取当前员工开班状态
    deskWorkStatus: 'workLog/workStatus',
    // 交班报告列表
    shiftReportList: 'workLog/shiftReportList',
    // 交班报告员工
    retailList: 'retail.user/list',
    // 交班小票
    workLogTicketDetail: 'workLog/ticketDetail',
    getShiftReport: '/ticket/getShiftReport',
    // 拆分账单
    splitOrder: 'deskOrder/splitOrder',
    // 推迟等叫
    waitDelay: 'message/waitDelay',
    // 添加发票
    invoiceAdd: 'invoice/add',
    // 获取当前桌台优惠信息 【会员价or会员折扣】
    deskRecordDiscountInfomation: 'deskRecord/getRecordDiscount',
    // 开启or关闭会员余额支付
    deskRecordEditIsBalance: 'deskRecord/editIsBalance',
    /**
     * 桌台列表专用缓存列表
     * item.recordList[0].record_info(桌台信息)
     * */
    fetchCacheDeskList: 'desk/cacheDeskList',
    // 获取当前交班小票信息
    getTrcket: '/workLog/ticket',
    // 获取到订单详情信息
    deskOrderDetail: '/deskOrder/detail',
    //  /workLog/ticketDetail
    ticketDetail: 'workLog/ticketDetail',
    // 合并账单
    mergeOrder: 'deskOrder/mergeOrder',
    // 可合并的桌台
    mergeOrderList: 'deskOrder/mergeOrderList',
    // 下单前生成点菜单小票
    deskOrderCreateOrderTicket: 'deskOrder/createOrderTicket',

    // 打印交班夏普
    printShiftReport: 'workLog/printShiftReport',
}

// 获取桌台列表
export function fetchDeskList(params: any) {
    return http.get(api.fetchDeskList, { params })
}

// 获取桌台分类列表
export function fetchCategoryList(params: any) {
    return http.get(api.fetchCategoryList, { params })
}

// 获取桌台分区列表
export function fetchRegionList(params: any) {
    return http.get(api.fetchRegionList, { params })
}

// 获取桌台详情
export function fetchDeskDetail(params: any) {
    return http.get(api.fetchDeskDetail, { params })
}

// 单席开台，空桌开台
export function openSingleDesk(data: any) {
    return http.post(api.openSingleDesk, data)
}

// 多席开台
export function openMostDesk(data: any) {
    return http.post(api.openMostDesk, data)
}

// 转台操作
export function moveDesk(data: any) {
    return http.post(api.moveDesk, data)
}

// 撤台操作
export function clearDesk(data: any) {
    return http.post(api.clearDesk, data)
}

// 搭台操作
export function groupDesk(data: any) {
    return http.post(api.groupDesk, data)
}

// 并台操作
export function mergeDesk(data: any) {
    return http.post(api.mergeDesk, data)
}

// 修改桌台使用人数（用餐人数）
export function deskEditUseNum(data: any) {
    return http.post(api.deskEditUseNum, data)
}

// 订单绑定用户(桌台绑定会员)
export function deskOrderBindUser(data: any) {
    return http.post(api.deskOrderBindUser, data)
}

// 锁台
export function deskLockDesk(data: any) {
    return http.post(api.deskLockDesk, data)
}

// 解除桌台锁定
export function deskUnLockDesk(data: any) {
    return http.post(api.deskUnLockDesk, data)
}

// 桌台订单结算
export function orderSettlement(data: any) {
    return http.post(api.orderSettlement, data)
}

// 下单之后的操作：修改规格\数量
export function orderFoodEditNum(data: any) {
    return http.post(api.orderFoodEditNum, data)
}

// 下单之后的操作：查询已点菜品数量和菜品详情
export function orderFoodDetail(params: any) {
    return http.get(api.orderFoodDetail, { params })
}

// 下单之后的操作：查询套餐详情
export function orderFoodgroupDetail(params: any) {
    return http.get(api.orderFoodgroupDetail, { params })
}

// 查询当前桌台可退菜菜品
export function orderFoodOperableFoodList(params: any) {
    return http.get(api.orderFoodOperableFoodList, { params })
}

// 列表退菜(批量退菜or全单退菜)[批量退菜也使用这个]
export function orderFoodBatchBack(data: any) {
    return http.post(api.orderFoodBatchBack, data)
}

// 取消/开启会员价，状态(0:关闭会员价 1:启用会员价)
export function editMemberPrice(data: any) {
    return http.post(api.editMemberPrice, data)
}

// 取消/开启会员折扣，状态(0:关闭会员折扣 1:启用会员折扣)
export function editMemberDiscount(data: any) {
    return http.post(api.editMemberDiscount, data)
}

// 修改不打折金额
export function editUnDiscountMoney(data: any) {
    return http.post(api.editUnDiscountMoney, data)
}

// 修改抹零金额
export function deskOrderReduceMoney(data: any) {
    return http.post(api.deskOrderReduceMoney, data)
}

// 修改菜品做法
export function orderFoodEditMaking(data: any) {
    return http.post(api.orderFoodEditMaking, data)
}

// 全桌上菜
export function deskRecordOrderServe(data: any) {
    return http.post(api.deskRecordOrderServe, data)
}

// 获取选中菜品桌台回显
export function deskOrderFoodRecordList(params: any) {
    return http.get(api.deskOrderFoodRecordList, { params })
}

// 多台开席回显，多台开席调整专用
export function deskMultipleRecordList(params: any) {
    return http.get(api.deskMultipleRecordList, { params })
}

// 修改服务费
export function deskOrderEditServiceMoney(data: any) {
    return http.post(api.deskOrderEditServiceMoney, data)
}

// 多台开席调整
export function deskEditMostDesk(data: any) {
    return http.post(api.deskEditMostDesk, data)
}

// 开班
export function deskStartWork(data: any) {
    return http.post(api.deskStartWork, data)
}

// 交班（结束营业）
export function deskEndWork(data: any) {
    return http.post(api.deskEndWork, data)
}




// 交班报告列表
export function shiftReportList(params: any) {
    return http.get(api.shiftReportList, { params })
}

// 交班报告员工
export function retailList(params: any) {
    return http.get(api.retailList, { params })
}

// 交班小票
export function workLogTicketDetail(params: any) {
    return http.get(api.workLogTicketDetail, { params })
}

// 打印交班夏普
export function printShiftReport(data: any) {
    return http.post(api.printShiftReport, data)
}

// 获取交班报告
export function getShiftReport(params: any) {
    return http.get(api.getShiftReport, { params })
}

// 拆分账单
export function splitOrder(data: any) {
    return http.post(api.splitOrder, data)
}

// 推迟等叫
export function waitDelay(data: any) {
    return http.post(api.waitDelay, data)
}

// 添加发票
export function invoiceAdd(data: any) {
    return http.post(api.invoiceAdd, data)
}

// 获取当前桌台优惠信息 【会员价or会员折扣】
export function deskRecordDiscountInfomation(params: any) {
    return http.get(api.deskRecordDiscountInfomation, { params })
}

// 开启or关闭会员余额支付
export function deskRecordEditIsBalance(data: any) {
    return http.post(api.deskRecordEditIsBalance, data)
}

// 获取桌台列表专用缓存列表
export function fetchCacheDeskList(params: any) {
    return http.get(api.fetchCacheDeskList, { params })
}

// 获取当前交班小票信息
export function getTrcket(params: any) {
    return http.get(api.getTrcket, { params })
}

// 获取到订单详情信息
export function deskOrderDetail(params: any) {
    return http.get(api.deskOrderDetail, { params })
}

// 交班小票详情
export function ticketDetail(params: any) {
    return http.get(api.ticketDetail, { params })
}

// 合并账单
export function mergeOrder(data: any) {
    return http.post(api.mergeOrder, data)
}

// 可合并的桌台
export function mergeOrderList(params: any) {
    return http.get(api.mergeOrderList, { params })
}

// 下单前生成点菜单小票
export function deskOrderCreateOrderTicket(data: any) {
    return http.post(api.deskOrderCreateOrderTicket, data)
}

// 使用装饰器的桌面API类
export class DesktopApi {
    @offlineApi('workLog', 'workStatus')
    static async deskWorkStatus(params: any) {
        return http.get(api.deskWorkStatus, { params })
    }
}
// 获取当前店铺开班状态 || 获取当前员工开班状态

export const deskWorkStatus = DesktopApi.deskWorkStatus


